<script type="text/javascript">              
$(document).ready(function(){

    $(".prod_check_trigger").click(function(){
        
        var unchecked = $(this).is('.unchecked');
        if (unchecked) {
            $(this).removeClass('unchecked'); 
            $(this).addClass('checked'); 
            input = '<input type="hidden" name="products[]" value="'+$(this).attr('rel')+'" />';                                            
            $(this).append(input);
            $(this).find('input').change();
        } else {
            $(this).addClass('unchecked');                                         
            $(this).removeClass('checked');                                         
            $(this).find('input').change().remove();
        }

        return false;
    })

})
</script>


<div style="overflow:auto">

<div class="live_search_msg"></div>    
<? 
foreach($available_products as $product) { 
    $selected = (in_array($product['id_Products'], $products));
?>
    
    <a class="prod_check_trigger product_block search <?=(!$selected)?'unchecked':'checked'?> <?=($product['Approved_Products']!=1)?'unapproved':(($product['Active_Products']=='1')?'active':'inactive')?>" href="#" rel="<?=$product["id_Products"]?>">
    <img src="<?=thumbnail(base_url().UPLOADS_FOLDER.PORTFOLIO_IMG_FOLDER.$product['Main_Image'])?>" />
    <span class="title"><?=$product['Name_Products']?></span>
    <? if($selected) {?>          
        <input type="hidden" name="products[]" value="<?=$product['id_Products']?>" />
    <? } ?>
    </a>

<? } ?>

</div>